package com.zhentao.controller;

import com.zhentao.image.ImageUploadRequest;

import com.zhentao.service.FileUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;


import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;




/**
 * @ClassName: VideoUploadController
 * @Author: 振涛教育_Q
 * @Date: 2024/12/5 14:20
 */
@RestController
@RequestMapping("/api")
public class VideoUploadController {

    @Autowired
    private FileUploadService fileUploadService;


    /**
     * @description  上传视频文件
     * @author 振涛教育_小Q
     * @date    2024/12/6 13:58
      * @param file
     * @return org.springframework.http.ResponseEntity<java.lang.String>
     */
    @PostMapping("/upload")
    public ResponseEntity<String> uploadVideo(@RequestParam("video") MultipartFile file){
        return fileUploadService.uploadVideo(file);
    }

    /**
     * @description 手绘上传图片文件
     * @author 振涛教育_小Q
     * @date 2024/12/6 13:59
     * @param request
     * @return org.springframework.http.ResponseEntity<java.lang.String>
     */
    @PostMapping("/upload-image")
    public ResponseEntity<?> uploadImage(@RequestBody ImageUploadRequest request) {
        return fileUploadService.uploadImage(request);
    }
}
